extends INode2DComponent


class_name Projectile
"""
投射物
"""


# 击中目标
signal event_hit_something(node: Projectile, body: Node2D, body_rid: RID, hit_normal: Vector2)
# 生命期结束时未击中目标
signal event_hit_nothing(node: Projectile)
# 超出屏幕可视范围
signal event_hit_out_of_screen(node: Projectile, hit_direction: Vector2)


## 挂载的子组件
@export var element: NamedComponent = null
## 词缀效果
@export var effects: Array[EffectValue] = []


var weapon: GunWeapon = null


func __check_exports() -> Dictionary:
    return IComponent.merge({
        "element": IComponent.find_child.bind(self, func(x): return x is NamedComponent, element),
    }, super.__check_exports())

func setup(arg: ProjectileResource) -> void:
    pass

func clone_source() -> ProjectileResource:
    return ProjectileResource.new()
